#include <iostream>
#include <string>
#include <vector>

#include <algorithm> // 算法头文件

using namespace std;

typedef struct book
{
    string name;
    int id;
} book;

book book_data[10] = {
    {.name = "《母猪产后护理》", .id = 1},
    {.name = "《关于找对象的101种技巧》", .id = 2},
    {.name = "《富婆通讯录》", .id = 3},
    {.name = "《霸道总裁爱上我》", .id = 4},
    {.name = "《如何一夜暴富》", .id = 5},
    {.name = "《郑迎佳自传》", .id = 6},
    {.name = "《葵花宝典&辟邪剑谱修炼心得》", .id = 7}};

bool is_find(book data)
{
    return data.id > 3;
}

int main(int argc, char const *argv[])
{
    vector<book> book_list;
    book_list.push_back(book_data[0]);
    book_list.push_back(book_data[1]);
    book_list.push_back(book_data[2]);
    book_list.push_back(book_data[3]);
    book_list.push_back(book_data[4]);

    auto it = find_if(book_list.begin(), book_list.end(), is_find);
    book book_temp = *it;
    cout << book_temp.id << book_temp.name << endl;

    return 0;
}